/**
 */
package mvc_generator.mVCGenerator.impl;

import java.util.Collection;

import mvc_generator.mVCGenerator.Config;
import mvc_generator.mVCGenerator.MVCGeneratorPackage;
import mvc_generator.mVCGenerator.View;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.common.util.EList;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;

import org.eclipse.emf.ecore.util.EDataTypeEList;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Config</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link mvc_generator.mVCGenerator.impl.ConfigImpl#getIndexView <em>Index View</em>}</li>
 *   <li>{@link mvc_generator.mVCGenerator.impl.ConfigImpl#getFrameworks <em>Frameworks</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class ConfigImpl extends MinimalEObjectImpl.Container implements Config
{
  /**
   * The cached value of the '{@link #getIndexView() <em>Index View</em>}' reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getIndexView()
   * @generated
   * @ordered
   */
  protected View indexView;

  /**
   * The cached value of the '{@link #getFrameworks() <em>Frameworks</em>}' attribute list.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getFrameworks()
   * @generated
   * @ordered
   */
  protected EList<String> frameworks;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  protected ConfigImpl()
  {
    super();
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  protected EClass eStaticClass()
  {
    return MVCGeneratorPackage.Literals.CONFIG;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public View getIndexView()
  {
    if (indexView != null && indexView.eIsProxy())
    {
      InternalEObject oldIndexView = (InternalEObject)indexView;
      indexView = (View)eResolveProxy(oldIndexView);
      if (indexView != oldIndexView)
      {
        if (eNotificationRequired())
          eNotify(new ENotificationImpl(this, Notification.RESOLVE, MVCGeneratorPackage.CONFIG__INDEX_VIEW, oldIndexView, indexView));
      }
    }
    return indexView;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public View basicGetIndexView()
  {
    return indexView;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setIndexView(View newIndexView)
  {
    View oldIndexView = indexView;
    indexView = newIndexView;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, MVCGeneratorPackage.CONFIG__INDEX_VIEW, oldIndexView, indexView));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EList<String> getFrameworks()
  {
    if (frameworks == null)
    {
      frameworks = new EDataTypeEList<String>(String.class, this, MVCGeneratorPackage.CONFIG__FRAMEWORKS);
    }
    return frameworks;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public Object eGet(int featureID, boolean resolve, boolean coreType)
  {
    switch (featureID)
    {
      case MVCGeneratorPackage.CONFIG__INDEX_VIEW:
        if (resolve) return getIndexView();
        return basicGetIndexView();
      case MVCGeneratorPackage.CONFIG__FRAMEWORKS:
        return getFrameworks();
    }
    return super.eGet(featureID, resolve, coreType);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @SuppressWarnings("unchecked")
  @Override
  public void eSet(int featureID, Object newValue)
  {
    switch (featureID)
    {
      case MVCGeneratorPackage.CONFIG__INDEX_VIEW:
        setIndexView((View)newValue);
        return;
      case MVCGeneratorPackage.CONFIG__FRAMEWORKS:
        getFrameworks().clear();
        getFrameworks().addAll((Collection<? extends String>)newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eUnset(int featureID)
  {
    switch (featureID)
    {
      case MVCGeneratorPackage.CONFIG__INDEX_VIEW:
        setIndexView((View)null);
        return;
      case MVCGeneratorPackage.CONFIG__FRAMEWORKS:
        getFrameworks().clear();
        return;
    }
    super.eUnset(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public boolean eIsSet(int featureID)
  {
    switch (featureID)
    {
      case MVCGeneratorPackage.CONFIG__INDEX_VIEW:
        return indexView != null;
      case MVCGeneratorPackage.CONFIG__FRAMEWORKS:
        return frameworks != null && !frameworks.isEmpty();
    }
    return super.eIsSet(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public String toString()
  {
    if (eIsProxy()) return super.toString();

    StringBuffer result = new StringBuffer(super.toString());
    result.append(" (frameworks: ");
    result.append(frameworks);
    result.append(')');
    return result.toString();
  }

} //ConfigImpl
